package com.briup.web.servlet;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

/**
 * 退出
 */
@WebServlet(name = "Servlet", value = "/logout")
public class LogOutServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //获取当前Session对象
        HttpSession session = request.getSession();
        //销毁session
        session.invalidate();
        //跳转回主页
        response.sendRedirect("/index.jsp");
    }

}
